# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Zach Bacon <11doctorwhocanada@gmail.com>

_realname=libnotify
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.7.7
pkgrel=1
pkgdesc="Desktop notification library (mingw-w64)"
arch=('any')
url="https://developer.gnome.org/notification-spec/"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-gtk3"
             "${MINGW_PACKAGE_PREFIX}-gnome-common"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-pkg-config" )
source=("https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"
        "introspection.patch"
        "test-fix.patch"
        "glib-mkenums.patch")
sha256sums=('9cb4ce315b2655860c524d46b56010874214ec27e854086c1a1d0260137efc04'
            '7c5795ac0a74a2d5efdc13ae05d610acc8176fce7114ed6b9322be4f0ca710e9'
            '185e7885512106172627525a4ec1fc18c2f95844f733e49cece325874a55f8e6'
            'fde6d3cd8c6000d21df1363eece53119827526b70e66e939eec3df1ba69cc141')

prepare() {
  cd $srcdir/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/introspection.patch
  patch -p1 -i ${srcdir}/test-fix.patch
  patch -p1 -i ${srcdir}/glib-mkenums.patch
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd "${srcdir}"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --enable-introspection=yes \
    --enable-gtk-doc

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
